drop function anniv_liste
CREATE FUNCTION anniv_liste
(
	@prev_id as varchar(255)
)
RETURNS varchar(255)
AS
BEGIN
	-- Declare the return variable here
	declare @liste_anniv as varchar(255)
	set @liste_anniv = ''

	select @liste_anniv = @liste_anniv + case p1.anniv when 'inconnu' then '...' else p1.anniv end + ', '
	  from personne p1
	 where prev_id = @prev_id and p1.sfam = 'Enfant'
--	 order by cast(isnull(p1.anniv, '0') as datetime)
	return substring(@liste_anniv, 0, isnull(len(@liste_anniv), 1) )
END
GO
